Which order are the and and the or evaluated?
public static boolean compare(boolean val1, boolean val2, boolean val3) {
boolean result = val1 && val2 && val3;
return result;
}
Function Call | Return Value | |||
---|---|---|---|---|
compare(true, true, true) | → | |||
compare(true, true, false) | → | |||
compare(true, false, true) | → | |||
compare(true, false, false) | → | |||
compare(false, true, true) | → | |||
compare(false, true, false) | → | |||
compare(false, false, true) | → | |||
compare(false, false, false) | → |
Experiment with this code on Gitpod.io